from sqlalchemy import Column, ForeignKey, Integer
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import backref, relation
from divirt import sqlalchemy_meta_data
from divirt import logging
from switch import Switch

log = logging.getLogger('divirt.components.cable')

Base = declarative_base(metadata=sqlalchemy_meta_data)
class Cable(Base):
    # Table
    __tablename__ = 'cables'
    id = Column(Integer, primary_key=True)
    switch1_id = Column(Integer, ForeignKey('switches.id'))
    switch2_id = Column(Integer, ForeignKey('switches.id'))

    # Relations this class may need some work
    #switch1 = relation(Switch, backref=backref('cables', sort_by=id))
    #switch2 = relation(Switch, backref=backref('cables', sort_by=id))

    def __init__(self):
        pass

    def __repr__(self):
        return '<Cable()>'
